<?php
declare(strict_types=1);
namespace SixShop\Lakala\Hook;

use app\model\User;
use SixShop\Core\Attribute\Hook;
use SixShop\Payment\Event\GatheringPaymentEvent;
use SixShop\Payment\PaymentInfo;
use SixShop\Wechat\Facade\WechatUser;

class LakalaHook
{
    /**
     * 上报提供的支付服务信息
     */
    #[Hook(GatheringPaymentEvent::class)]
    public function paymentInfoSubmission(GatheringPaymentEvent $event): PaymentInfo
    {
        return new PaymentInfo(
            'lakala',
            '拉卡拉',
            '拉卡拉',
            params: [
                'openid' => $event->request->userID?WechatUser::openid($event->request->userID):null,
            ]
        );
    }
}